<%@ Page Language="C#" Theme="Defaultsys" AutoEventWireup="true" CodeFile="BusinessRuleList.aspx.cs"
    Inherits="BusinessRuleList" Title="Rapport Plan System - Business rule list"
    MasterPageFile="~/MasterPage.master" %>

<%@ MasterType VirtualPath="~/MasterPage.master" %>
<asp:Content runat="server" ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1">
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
        <tr>
            <td class="contTable">
                <asp:GridView ID="grdBusinessRule" SkinID="gvGrid" runat="server" AutoGenerateColumns="false"
                    OnRowCommand="Command" Width="100%" OnRowDataBound="RowDataBound" AllowPaging="true"
                    OnPageIndexChanging="grdBusinessRule_PageIndexChanging">
                    <Columns>
                        <asp:TemplateField HeaderText="ID" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="3%">
                            <ItemTemplate>
                                <%# Container.DataItemIndex + 1 %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField HeaderText="Rule" DataField="Name" 
                        HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" />                        
                        
                        <asp:TemplateField HeaderText="Type" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" >
                            <ItemTemplate>
                                <%#GetRuleType(Eval("RuleType"))%>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        
                        
                        <asp:TemplateField HeaderText="Edit" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandArgument='<%# Eval("BusinessRuleId") %>' />
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="10%" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="Remove" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Button ID="btnRemove" runat="server" Text="Remove" CommandArgument='<%# Eval("BusinessRuleId") %>' />
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="10%" />
                        </asp:TemplateField>
                        
                    </Columns>
                    <EmptyDataTemplate>
                        There are currently no rules.</EmptyDataTemplate>
                    <PagerStyle VerticalAlign="Middle" HorizontalAlign="Left" Wrap="False" CssClass="paging"
                        Font-Bold="True"></PagerStyle>
                    <PagerSettings Mode="NumericFirstLast" />
                </asp:GridView>
                <asp:Button ID="btnAddNewRule" runat="server" OnClick="AddNewBusinessRule" Text="Add new rule" />
            </td>
        </tr>
    </table>
</asp:Content>
